package com.realestate.services;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.realestate.constants.ComTxManagerName;
import com.realestate.dao.AttributeDao;
import com.realestate.model.BrtbAttribute;

@Service
public class AttributeServiceImpl implements AttributeService{
	
	@SuppressWarnings("unused")
	private static final Logger LOGGER = Logger.getLogger(AttributeServiceImpl.class);
	
	@Autowired
    private AttributeDao attributeDao;
 
    public List<BrtbAttribute> getAllAttribute() {
        return attributeDao.getAllAttribute();
    }

	@Override
	public BrtbAttribute getAttributeByCode(String code) {
		return attributeDao.getAttributeByCode(code);
	}

	@Override
	@Transactional(value = ComTxManagerName.COM_TRANSACTION_MANAGER)
	public void persist(BrtbAttribute attribute) {
		attributeDao.persist(attribute);
		attributeDao.flush();
	}
}
